package cn.wolfcode.crm.query;

import cn.wolfcode.crm.util.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;


@Setter
public class ExpenditureQueryObject extends QueryObject{

    //数据传入使用日期类型
    @DateTimeFormat(pattern ="yyyy-MM-dd" )
    //转换成json格式的日期类型
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date beginDate;


    @DateTimeFormat(pattern ="yyyy-MM-dd" )
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endDate;

    public Date getBeginDate(){
        if (beginDate != null) {
            return DateUtil.getEndDate(beginDate);

        }
        return null;
    }

    public Date getEndDate(){
        if (endDate != null) {
            return DateUtil.getEndDate(endDate);

        }
        return null;
    }

}
